js remove last character

160

javascript remove last character from string -

const text = 'abcdef'
const editedText = text.slice(0, -1) //'abcde'

how to remove last char from string in javascript -

str=str.slice(0, -1);

JS remove last character -

var str= "Hello TecAdmin!";
var newStr = str.substring(0, str.length - 1);

Comments

Submit
0 Comments